using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography;

namespace Ufaev.Cryptography
{
	/// <summary>
	/// Computes the GOST R 34.11-94 hash for the input data.
	/// </summary>
	/// <remarks>
	/// The hash is used as a unique value of fixed size representing a large amount of data.
	/// Hashes of two sets of data should match if and only if the corresponding data also matches.
	/// Small changes to the data result in large unpredictable changes in the hash.
	/// 
	/// The hash size for the GOST R 34.11-94 algorithm is 256 bits.
	/// 
	/// This is an abstract class. The only implementation of this class is Gost3411Managed.
	/// </remarks>
	[ComVisible(true)]
	public abstract class Gost3411 : HashAlgorithm
	{
		#region Static Methods

		/// <summary>
		/// Creates an instance of the default implementation of GOST R 34.11-94.
		/// </summary>
		/// <returns>A cryptographic object.</returns>
		public static new Gost3411 Create()
		{
			return Create("Ufaev.Cryptography.Gost3411");
		}

		/// <summary>
		/// Creates an instance of a specified implementation of GOST R 34.11-94.
		/// </summary>
		/// <param name="hashName">The name of the specific implementation of GOST R 34.11-94 to be used.</param>
		/// <returns>A cryptographic object.</returns>
		public static new Gost3411 Create(string hashName)
		{
			return (Gost3411)CryptoConfig.CreateFromName(hashName);
		}

		#endregion Static Methods

		#region Constructors

		/// <summary>
		/// Initializes a new instance of <see cref="Gost3411"/>.
		/// </summary>
		protected Gost3411()
		{
			HashSizeValue = 256;
		}

		#endregion Constructors
	}
}
